import axios from "../../plugins/axios";
import { Message } from "element-ui";

const CMS_SERVER_BASE_URL = "http://localhost:10088/";

/**
 * permission
 */
export function getPermissionListAll(callback: any) {
  axios
    .post(
      CMS_SERVER_BASE_URL + "permission/getListPagingByCondition", {}
    )
    .then(res => {
      if (res.data.success) {
        callback(res.data.data);
      } else {
        Message({
          showClose: true,
          message: "数据获取失败！",
          type: "error"
        });
      }
    });
}

export function getPermissionListPagingByCondition(params: any, callback: any) {
  axios
    .post(
      CMS_SERVER_BASE_URL + "permission/getListPagingByCondition",
      params
    )
    .then(res => {
      if (res.data.success) {
        callback(res.data.data);
      } else {
        Message({
          showClose: true,
          message: "数据获取失败！",
          type: "error"
        });
      }
    });
}